package nk;

import java.util.Scanner;

/**
 * @author: Oliver
 * @time: 2020/6/10/7:29
 */
public class HashStr {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextLine()) {
            String str = sc.nextLine();
            String p = sc.nextLine();
            str = str.toLowerCase();
            p = p.toLowerCase();

            System.out.println(getPnum(str, p));
        }
    }

    private static int getPnum(String str, String p) {

        if (str.length() < 1 || p.length() < 1) {
            return 0;
        }

        char c = p.charAt(0);
        int count = 0;
        for (int i = 0; i < str.length(); i++) {
            char stchar = str.charAt(i);
            if (stchar == c) {
                count++;
            }
        }

        return count;
    }
}
